import it.webrules.deploymanager.core.dy.deploy.tomcat.TomcatConnection;
import it.webrules.xsd.dmc.config.v1.GeneralConfig;
import it.webrules.xsd.dmc.config.v1.WebappConfig.Deploys;
import it.webrules.xsd.dmc.config.v1.WebappConfig.Deploys.Tomcat;
import it.webrules.xsd.dmc.config.v1.WebappConfig.Deploys.Tomcat.Jmx;
import it.webrules.xsd.dmc.config.v1.WebappConfig.Deploys.Tomcat.Manager;

public class ConnecToTomcatMBean {

	public static void main(String[] args) throws Exception {

		Jmx jmx = new Jmx();
		jmx.setValue("service:jmx:rmi:///jndi/rmi://localhost:8934/jmxrmi");

		Manager manager = new Manager();
		manager.setUsername("tomcat");
		manager.setPassword("dom201180");
		manager.setValue("http://localhost:8080/manager/");

		Tomcat server = new Tomcat();
		server.setName("MioServer");
		server.setVersion("7.0.25");
		server.setEnginename("Catalina");
		server.setVirtualhost("localhost");
		server.setContextname("inapp3");
		server.setJmx(jmx);
		server.setManager(manager);

		Deploys deploys = null;
		GeneralConfig generalConfig = null;

		TomcatConnection tomcatConnection = new TomcatConnection(server, deploys, generalConfig);
		tomcatConnection.connect();
		tomcatConnection.getMBeanManager().findAJPConnector();

		System.in.read();
		tomcatConnection.checkConnect();
		tomcatConnection.getMBeanManager().findAJPConnector();

		System.in.read();
		tomcatConnection.checkConnect();
		tomcatConnection.getMBeanManager().findAJPConnector();
	}

}
